package com.etms.controller;

import com.etms.pojo.Goods_category;
import com.etms.pojo.SysUser;
import com.etms.service.HuopinService;
import com.etms.vo.PageParmas;
import com.etms.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("huopin")
public class HuopinContoller {
    @Autowired
    HuopinService huopinService;
    @PostMapping("getList")
    public Result HuopingetList(@RequestBody PageParmas pageParmas){
        return huopinService.findList(pageParmas);
    }

    @GetMapping("getById/{id}")
    public Result getById(@PathVariable("id") Integer id){
        return huopinService.findById(id);
    }

    @GetMapping("del/{id}")
    public Result delById(@PathVariable("id") Integer id){
        return huopinService.delById(id);
    }

    @PostMapping("updateOrAdd")
    public Result UpdateUser(@RequestBody  Goods_category goods_category){
        return huopinService.updateOrAdd(goods_category);
    }

    @GetMapping("baoyang/{id}")
    public Result baoyang(@PathVariable("id") Integer id){
        return huopinService.baoyang(id);
    }

    @GetMapping("getDanger")
    public Result getDanger(){
        return huopinService.getDanger();
    }
}
